package com.glela.goods.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.glela.goods.model.ShoppingCart;
import com.glela.goods.model.vo.ShoppingCartVo;

public interface ShoppingCartMapper {
	
    int deleteByPrimaryKey(Integer id);
    
    /***
     * 删除当前用户下面失效的购物车
     * @param userId
     * @return
     */
    int deleteInvalidShopppingCart(Integer userId) ;
    
    
    int insert(ShoppingCart record);

    int insertSelective(ShoppingCart record);

    ShoppingCart selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(ShoppingCart record);

    int updateByPrimaryKey(ShoppingCart record);
    
    public List<ShoppingCartVo> selectMoreInfoByUserId(long userId);
    
    public ShoppingCart selectByUserInventoryId(@Param("userId") Long userId,@Param("inventoryId") Long inventoryId);
    
    /***
     * 查询当前用户购买的限购
     * @param map<String,Object>  : 用户ID， 分时抢购ID， 
     * @return 已经购买的产品数量
     */
    public Long selectOrderDetailCount(Map<String,Object> map);
    
    
    
    public List<ShoppingCart> selectAll(ShoppingCart shoppingCart);
    
    
    public int selectAllCount(ShoppingCart shoppingCart);
    
    public List<ShoppingCart> selectByUserProductId(@Param("userId") Long userId,@Param("productId") Long productId,@Param("available") Long available );
    /***
     * 
     * @param map : orderObjectId , userId;
     * @return
     */
    public List<Integer> selectDeleteShoppingCartId(Map<String,Object> map);

    //关联活动表查询购物车
    public  List<ShoppingCartVo> selectAllProduct(ShoppingCart cart);
    //查询购物车精简版
    public  List<ShoppingCartVo> selectAllProductSimplify(ShoppingCart cart);
}